package com.yp.lession79.esqf2111.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author cos
 * @since 2022-03-24
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Emp extends Model<Emp> {

    private static final long serialVersionUID = 1L;
    @TableId
    private Integer eno;
    private String ename;
    private String esex;
    private Double salary;
    private String pwd;

    private Date borndate;
    private Integer dno;


    /** 一对一 情况
    Unknown column 'dept' in 'field list'
    使用mybatis 对象实体有处理
     会把实体类的属性都当成数据库的字段
     @TableField(exist = false) 这个属性不是数据库的字段
     */
    @TableField(exist =false)
    private Dept dept;



    public Emp(String ename, String esex, Double salary) {
        this.ename = ename;
        this.esex = esex;
        this.salary = salary;
    }

    public Integer getEno() {
        return eno;
    }

    public void setEno(Integer eno) {
        this.eno = eno;
    }
    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }
    public String getEsex() {
        return esex;
    }

    public void setEsex(String esex) {
        this.esex = esex;
    }
    public Double getSalary() {
        return salary;
    }

    public void setSalary(Double salary) {
        this.salary = salary;
    }
    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }
    public Date getBorndate() {
        return borndate;
    }

    public void setBorndate(Date borndate) {
        this.borndate = borndate;
    }
    public Integer getDno() {
        return dno;
    }

    public void setDno(Integer dno) {
        this.dno = dno;
    }

    @Override
    protected Serializable pkVal() {
        return this.eno;
    }

}
